const mock = require('mockjs')

function getContactList(req, res) {
    res.send(mock.mock({
        "code": 200,
        "message": '请求成功',
        "data|100-200": [
            {
                "name": '@cname',
                "phone": /(134[0-8]\d{7})|(14[5-9]\d{8})|(15\d{8})|(17[01235678]\d{8})|(18\d{8})/,
                "avatar": "@pick(['https://c-ssl.duitang.com/uploads/item/202006/25/20200625210505_jSZsN.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202102/02/20210202043527_0a2b2.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202103/19/20210319154234_7601e.thumb.1000_0.jpeg'])",
                "uid|+1": 1000,
                "dep": '@cword(2)'
            }
        ]
    }))
}

module.exports.contactList = getContactList;

function getChatList(req, res) {
    res.send(mock.mock({
        "code": 200,
        "message": '请求成功',
        "data": {
            "current": {
                "sessionName": '@cword(3,5)',
                "sessionType": '@pick([1,2])',
                "lastMsgTime": '@pick(["今天","昨天","上周","更早之前","11:50"])',
                "lastMsgType": '@pick([1,2,3,4,5,6])',
                "sessionImage": "@pick(['https://c-ssl.duitang.com/uploads/item/202006/25/20200625210505_jSZsN.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202102/02/20210202043527_0a2b2.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202103/19/20210319154234_7601e.thumb.1000_0.jpeg'])",
            },
            "recent|10-30": [
                {
                    "sessionName": '@cword(3,5)',
                    "sessionType": '@pick([1,2])',
                    "lastMsgTime": '@pick(["今天","昨天","上周","更早之前","11:50"])',
                    "lastMsgType": '@pick([1,2,3,4,5,6])',
                    "sessionImage": "@pick(['https://c-ssl.duitang.com/uploads/item/202006/25/20200625210505_jSZsN.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202102/02/20210202043527_0a2b2.thumb.1000_0.jpeg','https://c-ssl.duitang.com/uploads/blog/202103/19/20210319154234_7601e.thumb.1000_0.jpeg'])",
                }
            ]
        }
    }))
}

module.exports.chatList = getChatList